@extends('layouts.main')
@section('title')
订单列表
@endsection
@section('othercss')
<link rel="stylesheet" href="asset('css/magic.min.css')">
<style>
    html,body{width:100%;  margin:0;
              padding:0; font-family: "黑体"}

    .main{width:100%; margin:0;
          padding:0;}
    </style>
    @endsection
    @section('content')
    <div class="main">
    <div class="" style="width: 100%;height: 100px;background: #2B282F;position: absolute;z-index: -1;"></div>
    <div class="magictime " style="width: 100%;height: 150px;margin: 0 auto;position: relative;overflow: hidden">
        <img src="/images/ics1.png" style="width: 100%;height: 150px;position: absolute;z-index:-1;">
        <div style="color: white">
            <div style="float: left;padding-top: 30px;padding-left: 50px;overflow: hidden;">
                <div><h4>交易号</h4></div>
                <div style="background-color: rgba(255,255,255,0.3);border-radius: 15px;padding-left: 5px;padding-right: 5px;margin-top: 20px;">{{$order_num}}</div>
            </div>
            <div style="float: right;padding-top: 30px;padding-right: 50px;">
                <div><h4 style="text-align: right">总计</h4></div>
                <div style="margin-top: 10px;"><span style="font-size: 30px;">{{$total}}</span>元</div>
            </div>
        </div>
    </div>
    <div  style="width: 90%; margin: 0 auto;font-size: 15px;">
        商品列表<span style="border: 1px solid #cccccc;border-radius: 15px;margin-left: 5px;display: inline-block;width: 20px;text-align: center">{{count($orderList)}}</span>
    </div>
    {{--商品列表--}}
    <div class="magictime spaceInDown" style="margin-top: 20px;  padding-bottom: 100px;">
        @foreach($orderList as $orderinfo)
        <div style="width: 90%;height: 100px;;box-shadow: 0 0 30px #ccc;overflow: hidden;margin: 0 auto;border-radius: 10px;padding: 10px 10px; margin-top: 10px;">
            <div style="float: left;width: 25%"><img src="{{asset($orderinfo['goods_img'])}}" style="width: 100%; height: 100%;"></div>
            <div style="float: left;width: 60%;padding-left: 10px;">
                <div>商品编号 - {{$orderinfo['goods_id']}}</div>
                <div style="font-size: 19px;">{{str_limit($orderinfo['goods_name'],15)}}</div>
                <div style="font-size: 19px;color:#FD6479 ">{{$orderinfo['goods_subtotal']}}元 </div>
            </div>
            <div style="float: left;width: 15%;text-align: center;">
                <div style="margin-top: 18px;">{{$orderinfo['goods_subamount']}}</div>
                <div>数量</div>
            </div>
        </div>
        @endforeach
    </div>
    @if($isPay==0)
    <!--    href="http://undemo.shareg.cn/pay?order_id={{$order_id}}"-->
    <a> <div id="hreffei" onclick="WXPayment()"  style="background:#3E456C;color: white;text-align: center; position: fixed;bottom: 0;width: 100%;height: 50px; font-size: 15px;line-height: 50px;">
            付款<span>{{$total}}</span>元
        </div></a>
    @endif
</div>
@endsection
@section('otherjs')
<script>
    @if ($once == 'yes')
    alert('您上次的订单还未支付，请先结清上次的订单');
    @endif
    @if ($isPay == 0)
    var WXPayment = function () {
    if (typeof WeixinJSBridge === 'undefined') {
    alert('请在微信里打开页面！');
            return false;
    }
    WeixinJSBridge.invoke(
            'getBrandWCPayRequest', <?php echo $paymentjson ?>, function (res) {
            switch (res.err_msg) {
            case 'get_brand_wcpay_request:cancel':
                    alert('取消支付！');
                    break;
                    case 'get_brand_wcpay_request:fail':
                    alert('支付失败！（' + res.err_desc + '）');
                    break;
                    case 'get_brand_wcpay_request:ok':
                    alert('支付成功！');
                    //document.getElementById('hreffei').style.display = 'none';
                    location.href = '/pay_success?order_id={{$order_id}}';
                    break;
                    default:
                    alert(JSON.stringify(res));
                    break;
            }
            }
    );
    }
    @endif
</script>
@endsection